import request from '@/utils/request'
import { encryptionData } from '@/utils/com'

export function login(data) {
  return request({
    url: '/jcdSys/user/login',
    method: 'post',
    params: data
  })
}

export function getUserInfo(data) {
  return request({
    url: '/jcdSys/user/info',
    method: 'get',
    headers: encryptionData(data, '/user/info'),
    params: data
  })
}

export function logout() {
  return request({
    url: '/jcdSys/user/logout',
    method: 'post',
    headers: encryptionData({}, '/user/info'),
  })
}

/* 省-分站 */
export function getAreaSuspendPro() {
  return request({
    url: '/jcdPub/sysArea/getProv',
    method: 'get',
    headers: encryptionData({}, '/sysArea/getProv')
  })
}

/* 市-分站 */
export function getAreaSuspendCity(id) {
  return request({
    url: `/jcdPub/sysArea/getCityByProId/${id}`,
    method: 'get',
    headers: encryptionData({}, `/sysArea/getCityByProId/${id}`)
  })
}

/* 区-分站 */
export function getAreaSuspendByCityId(id) {
  return request({
    url: `/jcdSys/citySubstation/getAreaSuspendByCityId/${id}`,
    method: 'get'
  })
}